package top.sdwu_top.kbase.common.constants;

import org.springframework.security.core.parameters.P;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

public class Constants {
    //已删除
    public static final int YES = 1;
    //未删除
    public static final int NO = 0;


    public static final int DEL_FLAG_NORMAL = 0;


    public static final String NORMAL = "1";

    public static final String DISABLE = "0";


    public static final Map<String, String> FILE_TYPE_MAP = new HashMap<String, String>() {{
        put("md", "MARKDOWN");
        put("jpg", "JPG");
        put("jpeg", "JPEG");
        put("png", "PNG");
        put("xls", "XLS");
        put("xlsx", "xlsx");
        put("doc", "DOC");
        put("docx", "DOCX");
        put("txt", "txt");
        put("pdf", "pdf");
    }};

    public static String getFileType(String postfix) {
        String type =  FILE_TYPE_MAP.get(postfix.toLowerCase());
        if (Objects.isNull(type)) {
            return postfix.toUpperCase();
        }
        return type;
    }
}
